package com.mingweicai.intergration.redis.sentinel;

import java.util.HashSet;
import java.util.Set;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisSentinelPool;

//@Configuration
public class RedisSentinelConfiguration {


  @Bean
  public JedisSentinelPool jedisSentinelPool(){

    Set<String> set = new HashSet<>();
    set.add("localhost:26379");
    set.add("localhost:26380");
    set.add("localhost:26381");

    GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
    poolConfig.setMinIdle(10);
    poolConfig.setMaxIdle(20);
    poolConfig.setMaxTotal(50);

    return new JedisSentinelPool("mymaster", set, poolConfig, 3000);
  }

}
